package models

import (
	"github.com/astaxie/beego/orm"
)

type Activity struct {
	Id             int    `orm:"pk;auto"` //自增型主键ID
	ActivityName   string `orm:"size(128);null"`
	ActivityAmount string `orm:"size(32);null"`
	Created        string `orm:"size(64);null"`
	TopRule        string `orm:"size(64);null"`
	TailRule       string `orm:"size(64);null"`
	MiddleNum      int    `orm:"size(32);null"`
	Status         string `orm:"size(8);null"`
}

func (this *Activity) Insert() error {
	if _, err := orm.NewOrm().Insert(this); err != nil {
		return err
	}
	return nil
}

func (this *Activity) Update(fields ...string) error {
	if _, err := orm.NewOrm().Update(this, fields...); err != nil {
		return err
	}
	return nil
}

func (this *Activity) Read(fields ...string) error {
	if err := orm.NewOrm().Read(this, fields...); err != nil {
		return err
	}
	return nil
}

func init() {
	orm.RegisterModel(new(Activity))
}
